home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c,comp.lang.c++,alt.msdos.programmer
- Path: mxsld2.pd.infn.it!LORETI
- From: loreti@mxsld2.pd.infn.it (Maurizio Loreti)
- Subject: Re: Clearing the keyboard buffer
- X-Nntp-Posting-Host: mxsld2.pd.infn.it
- Message-ID: <DLt4p1.37x@news.cern.ch>
- Sender: news@news.cern.ch (USENET News System)
- Reply-To: loreti@mxsld2.pd.infn.it
- Organization: I.N.F.N. Padova - CDF/CMS VAXcluster
- References: <4dtqi4$60u@cdc2.cdc.net>,<4e07uh$oqq@huron.eel.ufl.edu>
- Date: Fri, 26 Jan 1996 21:22:11 GMT
-
- In article <4e07uh$oqq@huron.eel.ufl.edu>, afn03257@freenet2.freenet.ufl.edu (Daniel P Hudson) writes:
- >In article <4dtqi4$60u@cdc2.cdc.net>,
- >mart@vianet.on.ca (Mart) wrote:
- >
- > > I'm using Turbo C++ v. 3.1 and I need to be able to clear the keyboard
- > > BTW, this following bit of code wouldn't work :
- >
- > > while(kbhit()) getch();
- >
- > > Because I want the user to be able to just keep pushing the same key,
- > > making the above loop infinitly. If I don't clear the keyboard buffer,
- > > my code will continue believing that the user is pushing a key, even
- > > though their not.
- >
- > Huh? Once the buffer is caught up, it shouldn't continue, but you
- > might want to try fflush(stdin);
-
- Bullshit. Read the FAQ list to learn why this is an error;
- specifically Q/A 12.26:
-
- 12.26: How can I flush pending input so that a user's typeahead isn't
- read at the next prompt? Will fflush(stdin) work?
-
- --
- Maurizio Loreti http://mvxpd5.pd.infn.it/wwwcdf/mlo.html
- Un. of Padova, Dept. of Physics - Padova, Italy loreti@padova.infn.it
-